var health : int;
private var healthLeft : int;
var powerUpDropRate : float;
var powerUp : Transform;
private var dead = false;
function Start(){
	healthLeft = health;
}

function hit(damage){
	healthLeft = healthLeft - damage;
/* 	if (healthLeft <=0 && !dead) {
 * 		death();
 * 		dead = true;
 * 	}
 */
}

function death(){
	rand = Random.Range(0, 100);
	if (rand > powerUpDropRate) {
		return;
	}
	rand = Random.Range(0,100);
	if (rand <= 33){
		makePower("fireRatePowerUp");
	}
	else if (rand > 33 && rand <= 66){
		makePower("damagePowerUp");
	}
	else if (rand > 66 && rand <= 100){
		makePower("healthPowerUp");
	}

}

function makePower(powerType){
		power = Instantiate(powerUp, transform.position, transform.rotation);
		power.gameObject.tag = powerType;
}

function GetHealth(){
  return healthLeft;
}


